import { Service } from "..";
import { ProtoGrpcType } from "./proto/sample";
import { GreeterHandlers } from "./proto/helloworld/Greeter";
import * as path from "path";

new Service()
  .load<ProtoGrpcType, GreeterHandlers>({
    protoPath: path.resolve(__dirname, "./proto/sample.proto"),
    service: (p) => p.helloworld.Greeter.service,
    handler: {
      SayHello({ name }) {
        return { message: "Hello " + name };
      },
    },
  })
  .on(50051)
  .then(() => console.log("The micro Service is listening on localhost:50051"));
